import { post, get } from '../utils/request'
const headers = {
  'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}
// 查询所有定时消息模板
export const timedMsgListAPI = () => {
  return post('/admin/message/timingMsgTemplate/selectAll')
}
// 新增定时消息模板
export const timedMsgAddAPI = (data) => {
  return post('/admin/message/timingMsgTemplate/insert', data)
}
// 更新定时消息模板
export const timedMsgEditAPI = (data) => {
  return post('/admin/message/timingMsgTemplate/updateById', data)
}
// 删除定时消息模板
export const timedMsgDelAPI = (id) => {
  return post(
    '/admin/message/timingMsgTemplate/deleteById',
    { id },
    { headers }
  )
}
// 获取定时任务列表
export const timedMsgTaskListAPI = (data) => {
  return post('/admin/message/timingMsgTask/getTaskList', data)
}
// 新增定时任务
export const timedMsgTaskAddAPI = (data) => {
  return post('/admin/message/timingMsgTask/insert', data)
}

// 触发消息模板列表
export const triggerMsgListAPI = (data) => {
  return post('/admin/message/triggerMsgTemplate/selectAll', data)
}
// 新增触发消息模板
export const triggerMsgAddAPI = (data) => {
  return post('/admin/message/triggerMsgTemplate/insert', data)
}
// 更新触发消息模板
export const triggerMsgEditAPI = (data) => {
  return post('/admin/message/triggerMsgTemplate/updateById', data)
}
// 删除触发消息模板
export const triggerMsgDelAPI = (id) => {
  return post(
    '/admin/message/triggerMsgTemplate/deleteById',
    { id },
    { headers }
  )
}
// 获取动态字段列表
export const msgFieldAPI = () => {
  return get('/admin/message/dynamicMsgFields/selectAll')
}
// 获取所有触发消息
export const triggerMsgAPI = () => {
  return post('/message/selectAll')
}
